package com.cuangye;

import org.mybatis.spring.annotation.MapperScan;
import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
import org.springframework.boot.builder.SpringApplicationBuilder;
import org.springframework.boot.web.support.SpringBootServletInitializer;
import org.springframework.context.annotation.ComponentScan;

@SpringBootApplication
@ComponentScan
//注册 com.cuangye.mapper.dao 下的所有MyBatis映射接口
@MapperScan(basePackages = "com.cuangye.mapper.dao")
public class ChuangyebaApplication extends SpringBootServletInitializer {

	public static void main(String[] args) {
		SpringApplication.run(ChuangyebaApplication.class, args);
	}

	/**
	 * 用于构建项目打包成war包，单独在tomcat、resin等服务容器中运行
	 * @param builder
	 * @return
	 */
	@Override
	protected SpringApplicationBuilder configure(SpringApplicationBuilder builder) {
		// TODO Auto-generated method stub
		builder.sources(this.getClass());
		return super.configure(builder);
	}
}
